fix: missing Union import, hardcoded extension, multi-page index reset, Ollama timeout#307
Open
vidhip222 wants to merge 2 commits intofireform-core:mainfrom
Open
Conversation
…t, Ollama timeout
…, Pydantic V2, tests init, Dockerfile PYTHONPATH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Four bug fixes across the PDF filling pipeline and LLM integration layer.
src/main.py: Add missing Union import (Fixes [BUG]: Make exec fails because Union is not imported in src/main.py #274)
run_pdf_fill_process used Union[str, os.PathLike] in its type annotation but Union was never imported, causing a NameError on any call to this function.
src/filler.py: Replace hardcoded extension slicing (Fixes [BUG]: Hard-coded extension assumption breaks filename generation #247)
pdf_form[:-4] silently assumed a 4-character .pdf extension, producing corrupted output filenames for any other extension. Replaced with os.path.splitext() which correctly handles any file extension.
src/filler.py: Fix multi-page PDF field index reset (Fixes [BUG]: Multi-page PDF filling resets answer index and misaligns fields #238)
The answer index i was initialised inside the page loop, resetting to 0 on every page. Fields on pages 2+ were incorrectly filled with values already used on page 1. Moved i outside the loop so it advances continuously across all pages.
src/llm.py: Add timeout to Ollama requests (Fixes [BUG]: Ollama request path lacks timeout and robust error handling #228)
requests.post() had no timeout, causing the server to hang indefinitely if Ollama was slow or unresponsive. Added a 60-second timeout and a dedicated Timeout exception handler with a descriptive error message.
Issues:
Fixes #274
Fixes #247
Fixes #238
Fixes #228
Type of change
How Has This Been Tested?
Test Configuration:
Checklist: